<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>任务管理</title>
	<%@include file="/WEB-INF/jsp/public/admin_commons.jspf" %>
	<script type="text/javascript" src="${basePath }/js/training.js"></script>
</head>

<body class="right_body">
<div id="inndiv"></div>
<div class="right">
	<div class="Lnav">您的当前位置：多数据库营销系统管理&nbsp;&gt;&nbsp;任务管理&nbsp;&gt;&nbsp;任务维护</div>
  <div class="title"><img src="${basePath }/images/title_icon1.gif" class="Ticn" />任务维护</div>
  <div class="content">
    	<div class="search">
            <div class="srch_content">
          	 <form action="${basePath }/admin/AcademyAction_save.action" id="academyForm" method="post" >
	           	  学院名称：<input type="text" size="16" name="academy.name" id="academyName"  class="input_txt1 required" />
	             <input type="button" onclick="submitAcademyForm()" value="添加" class="btn1" />
           	  </form>
           	  
           	  <form action="${basePath }/admin/MajoreAction_save.action" id="majoreForm" method="post" >
	           	  学院名称：
	           	  <select name="aid" id="academyId">	
	           	  	<option value="-1">请选择学院</option>
	           	  	<c:forEach items="${academyList}" var="academy">
	           	  		<option value="${academy.id }">${academy.name }</option>
	           	  	</c:forEach>
	           	  </select>
	           	   专业名称:<input type="text" size="16" name="majore.name" id="majoreName"  class="input_txt1" />
	             <input type="button" onclick="submitMajoreForm()" value="添加" class="btn1" />
               </form>
             
            </div>
    	</div>
        <div class="data">
        <form id="dataForm">
                <div class="data_hdr1">
                    <div class="lft">
                    <input name="" type="button" value="新建" class="btn1" onclick="location.href='${basePath }/admin/AcademyAction_toSavePage.action'" />
                    <input name="" type="button" value="修改" class="btn1" onclick="modifyAcademy()" />
                    <input name="" type="button" value="删除" class="btn1" onclick="deleteAcademy()" />
                    </div>
                </div>
                <div class="XscrollTbl">
                <table width="100%" cellspacing="1" class="data_table1">
                    <tr class="data_Ttit">
                        <td width="5%">选择</td>
                        <td width="5%">序号</td>
                        <td width="20%">学院名称</td>
                        <td width="70%">专业</td>
                    </tr><%int i=1; %>
                    <c:forEach items="${academyList}" var="academy">
	                    <tr>
	                    	<td><input type="checkbox" value="${academy.id }"/></td>
	                        <td><%=i++ %></td>
	                        <td>${academy.name }</td>
	                        <td>
	                        <c:forEach items="${academy.majores }" var="majore">
	                        	${majore.name }<a href="${basePath }/admin/MajoreAction_delete.action?id=${majore.id }" onClick="return deleteConfirm()">[删除]</a>
	                        </c:forEach>
	                        </td>
	                    </tr>
					</c:forEach>
                </table>
                </div>
                <div class="pages">
                	<input type="hidden" id="pageCount" value="${pv.pageCount}">
                        <div class="leftFloat selct">
                        <a href="javascript:checkAll()">全选</a> - 
                        <a href="javascript:reserveCheck()">反选</a> - 
                        <a href="javascript:checkAllNo()">不选</a></div>
                </div>
                </form>
        </div>
    </div>
</div>
<script type="text/javascript" src="${basePath }/js/highLightRow.js"></script>
<script type="text/javascript" src="${basePath }/js/cancelBtn.js"></script>
<script type="text/javascript" src="${basePath }/js/firm.js"></script>

<script language="javascript">

//批量删除
function deleteAcademy(){
	var selected = $(":checked");
	if(selected.size()==0){
		alert("请选择您要删除的学院！");
		return;
	}
	if(confirm("您确定要删除吗？")){
		var academyId = "";
		for(i=0;i<selected.size();i++){
			if(i==0){
				academyId +="academyId="+selected[i].value;
			}else{
				academyId +="&academyId="+selected[i].value;
			}
		}
		location.href = "${basePath }/admin/AcademyAction_delete.action?"+academyId;
	}
}

function modifyAcademy(){
	var selected = $(":checked");
	if(selected.size()==0){
		alert("请选择您要修改的学院！");
		return ;
	}
	if(selected.size()>1){
		alert("一次只能修改一条记录！");
		return ;
	}
	location.href = "${basePath }/admin/AcademyAction_toEditPage.action?id="+selected[0].value;
}

function submitAcademyForm(){
	if(isNull($("#academyName").val())){
		alert("学院名称不能为空！");
		return;
	}
	$('#academyForm').submit();
}

function submitMajoreForm(){
	if($("#academyId").val()==-1){
		alert("学院名称不能为空！");
		return;
	}
	if(isNull($("#majoreName").val())){
		alert("专业名称不能为空！");
		return;
	}
	$('#majoreForm').submit();
}
</script>

</body>
</html>


